package week0501;

import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Toolkit;
import javax.swing.JComponent;
import javax.swing.JFrame;
public class Main3 {

	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				JFrame frame=new NotHelloworldFrame();
				frame.setTitle("郑玉波");
				frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				frame.setLocation(400, 200);
				frame.setVisible(true);
			}
		});
		
	}
	
}

class NotHelloworldFrame extends JFrame{
	private static final long serialVersionUID = 1L;

	public NotHelloworldFrame(){
		add(new NotHelloworldComponent());
		pack();
	}
}
class NotHelloworldComponent extends JComponent{
	private static final long serialVersionUID = 1L;
	private static final int MESSAGE_X=300;
	private static final int MESSAGE_Y=200;
	Toolkit kit =Toolkit.getDefaultToolkit();
	Dimension screenSize=kit.getScreenSize();
	private final int DEFAULT_WIDTH=screenSize.width/2;
	private final int DEFAULT_HEIGHT=screenSize.height/2;

	protected void paintComponent(Graphics g) {
		g.drawString("郑玉波", MESSAGE_X, MESSAGE_Y);
		
	}

	public Dimension getPreferredSize() {
		return new Dimension(DEFAULT_WIDTH,DEFAULT_HEIGHT);
	}	

}